<div class="row">
    <div class="col-sm-12">

        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">{$title|default="主页面"}</h3>
            </div>
            <div class="panel-body">
                <form method="post" action="__URL__/add?id={$id}" role="form" id="ClassEdit" class="validate">
                    <div class="form-group">
                        <label for="Name" class="control-label">培训计划名称：</label>
                        <input type="text" id="Name" name="Name" class="form-control"
                               data-validate="required" placeholder="请输入培训计划名称" data-message-required="请输入培训计划名称"
                               value="{$data.name}">
                    </div>
                    <div class="form-group">
                        <label for="RegistrationStartTime" class="control-label">报名起止时间：</label>
                        <div class="row">
                            <div class="col-md-4">
                                <div class="input-group">
                                    <input id="RegistrationStartTime" name="RegistrationStartTime"
                                           class="form-control datetimepicker" type="text"
                                           data-validate="required" placeholder="请输入报名开始时间"
                                           data-message-required="请输入报名开始时间"
                                    <if condition="$id neq 0">value="{$data.registrationstarttime|datetime}"</if>
                                    />
                                    <span class="input-group-btn">
                                        <button class="btn btn-gray" type="button"
                                                onclick="javascript: $('#RegistrationStartTime').val('');">
                                            <i class="glyphicon glyphicon-remove"></i>
                                        </button>
                                    </span>
                                </div>
                            </div>
                            <div class="col-md-1 text-center">至</div>
                            <div class="col-md-4">
                                <div class="input-group">
                                    <input id="RegistrationEndTime" name="RegistrationEndTime"
                                           class="form-control datetimepicker" type="text"
                                           data-validate="required" placeholder="请输入报名结束时间"
                                           data-message-required="请输入报名结束时间"
                                    <if condition="$id neq 0">value="{$data.registrationendtime|datetime}"</if>
                                    />
                                    <span class="input-group-btn">
                                        <button class="btn btn-gray" type="button"
                                                onclick="javascript: $('#RegistrationEndTime').val('');">
                                            <i class="glyphicon glyphicon-remove"></i>
                                        </button>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="StartTime" class="control-label">培训计划起止时间：</label>
                        <div class="row">
                            <div class="col-md-4">
                                <div class="input-group">
                                    <input id="StartTime" name="StartTime" class="form-control datetimepicker"
                                           type="text"
                                           data-validate="required" placeholder="请输入计划开始时间"
                                           data-message-required="请输入计划开始时间"
                                    <if condition="$id neq 0">value="{$data.starttime|datetime}"</if>
                                    />
                                    <span class="input-group-btn">
                                        <button class="btn btn-gray" type="button"
                                                onclick="javascript: $('#StartTime').val('');">
                                            <i class="glyphicon glyphicon-remove"></i>
                                        </button>
                                    </span>
                                </div>
                            </div>
                            <div class="col-md-1 text-center">至</div>
                            <div class="col-md-4">
                                <div class="input-group">
                                    <input id="EndTime" name="EndTime" class="form-control datetimepicker" type="text"
                                           data-validate="required" placeholder="请输入计划结束时间"
                                           data-message-required="请输入计划结束时间"
                                    <if condition="$id neq 0">value="{$data.endtime|datetime}"</if>
                                    />
                                    <span class="input-group-btn">
                                        <button class="btn btn-gray" type="button"
                                                onclick="javascript: $('#EndTime').val('');">
                                            <i class="glyphicon glyphicon-remove"></i>
                                        </button>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <div class="col-md-6">
                                <label for="TrainingCost" class="control-label">培训费：</label>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="input-group">
                                            <span class="input-group-addon">￥</span>
                                            <input id="TrainingCost" name="TrainingCost" class="form-control" size="10"
                                                   type="text"
                                                   data-validate="number" placeholder="请输入培训费"
                                                   data-message-required="请输入培训费" value="{$data.trainingcost}"/>
                                            <span class="input-group-addon">.00</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="AllowNumberOfCourses" class="control-label">允许选课数：（0-选择全部）</label>
                                    <div class="row">
                                        <div class="col-md-6">
                                            <!-- Input spinner, just add class "spinner" to input-group and it will be activated -->
                                            <div class="input-group spinner" data-step="1" data-min="0" data-max="10">
                                                <span class="input-group-btn">
                                                    <button class="btn btn-gray" data-type="decrement">-</button>
                                                </span>
                                                <input id="AllowNumberOfCourses" name="AllowNumberOfCourses" type="text"
                                                       class="form-control text-center"
                                                       value="{$data.allownumberofcourses|default=1}" readonly="1"
                                                       data-validate="number"/>
                                                <span class="input-group-btn">
                                                    <button class="btn btn-gray" data-type="increment">+
                                                    </button>
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <label for="MinPassResult" class="control-label">总成绩合格标准：</label>
                                <div class="row">
                                    <div class="col-md-6">
                                        <input id="MinPassResult" name="MinPassResult" class="form-control" size="10"
                                               type="text" data-validate="number"
                                               value="{$data.minpassresult|default=60}"/>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="PeriodNumberCode" class="control-label">期数代码：</label>
                                    <div class="row">
                                        <div class="col-md-6">
                                            <input id="PeriodNumberCode" name="PeriodNumberCode" class="form-control"
                                                   type="text" data-validate="required"
                                                   placeholder="00表示试点" data-message-required="请输入期数代码"
                                                   value="{$data.periodnumbercode}"/>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="form-group">
                        <div class="row col-margin">
                            <div class="col-md-12">
                                <label for="IsOpen" class="control-label">是否开放：</label>
                                <p>
                                    <label class="radio-inline">
                                        <input type="radio" id="IsOpen-1" name="IsOpen" value="1"
                                        <if condition="$data.isopen eq 1">checked</if>
                                        >
                                        开放
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" id="IsOpen-2" name="IsOpen" value="0"
                                        <if condition="$data.isopen eq 0">checked</if>
                                        >
                                        不开放
                                    </label>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row col-margin">
                            <div class="col-md-12">
                                <label for="Description" class="control-label">培训介绍：</label>
                                <textarea id="Description" name="Description" class="form-control" row="5">{$data.description}</textarea>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-5 col-sm-7">
                            <input type="hidden" id="ID" name="ID" value="{$id}">
                            <input type="submit" id="btnSave" value="  保 存  " class="btn btn-primary" onclick="Save()"/>
                            <input type="button" value="  返 回  " class="btn btn-info" onclick="history.go(-1)"/>
                        </div>
                    </div>
                </form>

            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        var regConfig = {
            language: 'cn',
            separator: ' 至 ',
            format: 'YYYY年MM月DD日 HH:mm',
            autoClose: false,
            time: {
                enabled: true
            },
            getValue: function () {
                if ($('#RegistrationStartTime').val() && $('#RegistrationEndTime').val())
                    return $('#RegistrationStartTime').val() + ' 至 ' + $('#RegistrationEndTime').val();
                else
                    return '';
            },
            setValue: function (s, s1, s2) {
                $('#RegistrationStartTime').val(s1);
                $('#RegistrationEndTime').val(s2);
            }
        };

        var Config = {
            language: 'cn',
            separator: ' 至 ',
            format: 'YYYY年MM月DD日 HH:mm',
            autoClose: false,
            time: {
                enabled: true
            },
            getValue: function () {
                if ($('#StartTime').val() && $('#EndTime').val())
                    return $('#StartTime').val() + ' 至 ' + $('#EndTime').val();
                else
                    return '';
            },
            setValue: function (s, s1, s2) {
                $('#StartTime').val(s1);
                $('#EndTime').val(s2);
            }
        };

        $('#RegistrationStartTime').dateRangePicker(regConfig);
        $('#RegistrationEndTime').dateRangePicker(regConfig);

        $('#StartTime').dateRangePicker(Config);
        $('#EndTime').dateRangePicker(Config);
    });
</script>
